import request from "./request";

interface ResultType<T> {
  code: number;
  message: string;
  data: T;
}
interface userAllType{
  account: string;
  username: string;
  sex: string;
  type: string | number;
  pageSize: number;
  current: number;
}
interface UserResult{
  total: number;
  userList: [];
}
export function queryUserAll(params:userAllType) {
  return request<UserResult, ResultType<UserResult>>({
    url: '/user/all',
    method: 'get',
    params: params
  });
}

export function deleteUser(id:number) {
  return request<[], ResultType<[]>>({
    url: '/user/delete',
    method: 'post',
    data: {
      id
    }
  })
}

interface updateUserType{
  id: string | number;
  account: string;
  username: string;
  sex: string;
  age: string | number;
  type: string | number;
}
export function updateUser(data:updateUserType){
  return request<[], ResultType<[]>>({
    url: '/user/update',
    method: 'post',
    data,
  })
}
